import java.util.Arrays;

public class Solution299 {
    public String getHint(String secret, String guess) {
        int[] a=new int[10];
        int[] b=new int[10];
        Arrays.fill(a,0);
        Arrays.fill(b,0);
        int count=0;
        char[] secrets=secret.toCharArray();
        char[] guesses=guess.toCharArray();
        for (int i=0;i<secrets.length;i++){
            if (secrets[i]==guesses[i]){
                count++;
            }else{
                a[secrets[i]-'0']++;
                b[guesses[i]-'0']++;
            }
        }
        int ans=0;
        for (int i=0;i<10;i++){
            ans=ans+Math.min(a[i],b[i]);
        }
        return count+"A"+ans+"B";
    }

    public static void main(String[] args) {
        System.out.println(new Solution299().getHint("1807","7810"));
    }
}
